package com.cumt.threeway.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.TextView;

import com.cumt.threeway.R;
import com.cumt.threeway.table.GonglueEntity;

/**
 * Created by 胡晶晶 on 2016/5/24.
 */
public class StrategyInfoActivity extends FragmentActivity implements View.OnClickListener{
    private TextView mTvTitle;
    private TextView mTvUserName;
    private TextView mTvDate;
    private TextView mTvContent;
    private GonglueEntity mStrategy;
    private String mFlag;
    private TextView mTextViewTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_strategy_info_activity);
        initView();
    }

    private void initView() {
        mStrategy = (GonglueEntity) getIntent().getSerializableExtra("strategy");
        mFlag = getIntent().getStringExtra("flag");
        findViewById(R.id.btn_back).setOnClickListener(this);
        mTextViewTitle = (TextView) findViewById(R.id.tv);
        mTvTitle = (TextView) findViewById(R.id.tv_title);
        mTvUserName = (TextView) findViewById(R.id.tv_userName);
        mTvDate = (TextView) findViewById(R.id.tv_date);
        mTvContent = (TextView) findViewById(R.id.tv_content);
        if("all".equals(mFlag)) {
            mTextViewTitle.setText(getResources().getString(R.string.strategy_message));
        } else if("my".equals(mFlag)) {
            mTextViewTitle.setText(getResources().getString(R.string.my_strategy_message));
        }
        mTvTitle.setText(mStrategy.getTitle());
        mTvUserName.setText(mStrategy.getUserName());
        mTvDate.setText(mStrategy.getTime());
        mTvContent.setText("\u3000\u3000" + mStrategy.getContent());
    }

    @Override
    public void onClick(View v) {
        if(v == null) {
            return;
        }
        switch (v.getId()) {
            case R.id.btn_back:
                finish();
                break;
        }
    }
}
